package org.poc.camel;

import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.main.Main;

public class CamelRunFtp {

	/**
	 * @param args
	 * @throws Exception
	 */
	public static void main(String[] args) throws Exception {
/*
        CamelContext context = new DefaultCamelContext();
        context.addRoutes(new RouteBuilder() {
            public void configure() {

 from("ftp://localhost/messages?username=ftpuser&password=ftpuser&noop=true&fileName=tmp")

 .to("file:data/outbox");

            }
        });

        context.start();
        
        Thread.sleep(1000L);
        
        context.stop();
        */
       
		
		Main camelMain = new Main();
		camelMain.enableHangupSupport();
		camelMain.addRouteBuilder(new RouteBuilder() {
			public void configure() {

				from(
						"ftp://localhost/messages?username=ftpuser&password=ftpuser&fileName=tmp&delay=1000")
				.log("Retrieving ${body}")
				.to("file:data/outbox/tmpout");

			}
		});

		camelMain.run();

	}

}
